package cn.jingyuan.swan.cloud.core;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;


/**
 * 标准响应模型
 *
 * @param <D> 响应数据的类型
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@Accessors(chain = true)
public class Result<D> implements Serializable {

    /** 编码 */
    protected String code;

    /** 编码消息 */
    protected String codeMsg;

    /** 数据 */
    protected D data;

    public Result(String code, String codeMsg) {
        this(code, codeMsg, null);
    }

    public Result(String code, String codeMsg, D data) {
        this.code = code;
        this.codeMsg = codeMsg;
        this.data = data;
    }

}
